#include <iostream>
#include <unordered_set>

using namespace std;

int main()
{
    int T; //cin >> T;
    scanf("%d",&T);
    while(T--)
    {
        int n;// cin >> n;
        scanf("%d",&n);
        unordered_set<int> mp;

        for(int i = 1;i <= n;i++)
        {
            int x;//cin >> x;
            scanf("%d",&x);
            if(!mp.count(x))
            {
                //cout << x << " ";
                printf("%d ",x);
                mp.insert(x);
            }
        }

        //cout << endl;
        puts("");
    }

    return 0;
}